package com.example.day43_opengl_filter2;

import android.content.Context;
import android.opengl.GLES20;

/**
 * Description:
 * Created by Gdu on 2021/5/7 1:31.
 */

public class CameraFilter extends AbstractFboFilter {
    private float[] mtx;
    private int vMatrix;

    public CameraFilter(Context context) {
        super(context, R.raw.camera_vert, R.raw.camera_frag);
        //变换矩阵,需要将原来的vCoord与矩阵相乘
        vMatrix = GLES20.glGetUniformLocation(program, "vMatrix");
    }

    @Override
    public void beforeDraw() {
        super.beforeDraw();
        //将矩阵传递下去
        GLES20.glUniformMatrix4fv(vMatrix, 1, false, mtx, 0);
    }

    public void setTransformMatrix(float[] mtx) {
        this.mtx = mtx;
    }

}
